<?php
function selectTb($requete)
{
include 'infobd.php';

$con = mysql_connect($serv,$user,$passw);
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db($db, $con);
$result = mysql_query($requete);

$rows = array();
$introw = 0;

while($row = mysql_fetch_array($result, MYSQL_NUM))
{
  $rows[$introw]=$row;
  $introw++;
}

mysql_close($con);

return $rows;
}

function selectTbString($requete, $header)
{
$tbs=selectTb($requete);

$text='<table border="1"><tr>';

foreach ($header as $h)
{
$text = $text . "<th>" . $h . "</th>";
}
$text = $text . "</tr>";
foreach ($tbs as $tb)
	{
		$text=$text . '<tr>';
		foreach ($tb as $elem)
		{
			$text=$text . '<td>' . $elem . '</td>';
		}
		$text=$text . '</tr>';
	}
$text=$text . '</table>';
return $text;
}
?>	